package com.yhq.spring.lifecycle;

import com.yhq.spring.lifecycle.conf.Config1;
import com.yhq.spring.lifecycle.conf.LifeCycleConf;
import com.yhq.spring.lifecycle.service.AnimalService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author hqyin
 * @date 2023/4/24 3:36 下午
 */
public class TestLifeCycle {
    public static void main(String[] args) {
        //1.测试生成BeanDefinition
        //测试@Import
        test_import();
        //测试@ComponentScan
        //test_componentScan();

    }

    private static void test_import() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config1.class);
        AnimalService animalService = (AnimalService) context.getBean("animalService");
        System.out.println(animalService);
    }

    private static void test_componentScan() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(LifeCycleConf.class);

    }
}
